from aip import AipImageClassify #加载百度识别库
import random
APP_ID = '15836728'
API_KEY = 'KE9KUEv8eVnFl4QURxGte5Pg'
SECRET_KEY = 'DBeRG73N9oNUQsqYC4U6dH8HbDcyV2jZ'

def get_file_content(filePath):
    with open(filePath,'rb') as fp:
        return fp.read()

def 识别函数(path,A,B,C):
    百度识图=AipImageClassify(APP_ID,API_KEY,SECRET_KEY)
    图片路径=path
    name=""
    result=百度识图.animalDetect(get_file_content(图片路径))
    #result=百度识图.flower(get_file_content(图片路径))
    name=result["result"]
    x=[0,3,4]
    random.shuffle(x)
    a=name[x[0]]
    b=name[x[1]]
    c=name[x[2]]
    A.set(a["name"])
    B.set(b["name"])
    C.set(c["name"])
    return a,b,c
    pass